#pragma once
#include <QWidget>
#include "../Detail/BondChart/bondquotecdcchart.h"
#include "BondDetailData.h"
class DetailData;
class BondAprismtHistoryData;

class BondDetailPrcAprismtData : public DetailData
{
	Q_OBJECT
public:
	BondDetailPrcAprismtData(BondDetailDlg* p);
	void reqCDCData(const char* bondKey = nullptr);
};

class BondDetailPrcAprismtTitle : public QWidget
{
public:
	BondDetailPrcAprismtTitle(QWidget* p = nullptr);
	void setText(QString txt);
protected:
	void paintEvent(QPaintEvent* event) override;
private:
	QString		m_title = "";
};

class BondDetailPrcAprismt : public QWidget
{
	Q_OBJECT
public:
    BondDetailPrcAprismt(QWidget* p, QSharedPointer<DetailData> data);
	~BondDetailPrcAprismt();
	void setReqBondKey(const std::string& strBondKey);
protected:
	void getData();
protected slots:
	void onBondCDCChanged();
	void onBondCDCLeftDrag(double ratio);
	void onBondCDCRightDrag(double ratio);
	void onBondCDCCentralDrag(double ratio1, double ratio2);
private:
	BondDetailPrcAprismtData*	m_prcAprismtdata = nullptr; //点击的bond
	QSharedPointer<DetailData>  m_data = nullptr;
	BondDetailDlg*				m_dlg = nullptr;
	std::string					m_strReqAprismt = "";//请求中债估值的bondkey
	BondQuoteCDCChart*			m_pAprsmtChart = nullptr;
	QString						m_strBondShortName = "";
	CBondInfo					m_bondInfo;//点击的bond
	BondDetailPrcAprismtTitle*	m_prcAprismTitle = nullptr;
};